import os
import time
from pprint import pprint

from selenium import webdriver
#打开浏览器
driver=webdriver.Chrome()
driver.get('https://www.baidu.com')

#操作cookie
#获得所有的cookies信息
pprint(driver.get_cookies())

# driver.get_cookie(name) 返回特定name 有cookie 信息
pprint(driver.get_cookie('ZEY'))

# driver.add_cookie(cookie_dict)添加cookie,必须有name 和value 值
# dict={'name':'hello','value': '123456'}
# driver.get_cookie(dict)
# pprint(driver.get_cookies())


# driver.delete_cookie(name)删除特定(部分)的cookie信息
driver.delete_cookie('hello')
pprint(driver.get_cookies())

# driver.delete_all_cookies()删除所有cookie 信息
driver.delete_all_cookies()

driver.quit()
